package pers.mine.po;

import java.util.ArrayList;
import java.util.List;

public class Ordergoods {
	private Integer id;

	private Integer oid;

	private Integer gid;

	private String name;

	private Integer sum;

	private Double price;

	public static List<Ordergoods> createOrdergoodsList(Integer oid,
			List<GoodsItem> goodsItemList) {
		List<Ordergoods> OrdergoodsList = null;

		if (oid != null && goodsItemList != null && goodsItemList.size() > 0) {

			OrdergoodsList = new ArrayList<Ordergoods>();
			Ordergoods one = null;

			for (GoodsItem gi : goodsItemList) {
				one = new Ordergoods();
				one.setOid(oid);
				one.setGid(gi.getId());
				one.setName(gi.getName());
				one.setPrice(gi.getPrice());
				one.setSum(gi.getNum());

				OrdergoodsList.add(one);
			}
			return OrdergoodsList;
		}
		return null;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getOid() {
		return oid;
	}

	public void setOid(Integer oid) {
		this.oid = oid;
	}

	public Integer getGid() {
		return gid;
	}

	public void setGid(Integer gid) {
		this.gid = gid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getSum() {
		return sum;
	}

	public void setSum(Integer sum) {
		this.sum = sum;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	@Override
	public String toString() {
		return "Ordergoods [id=" + id + ", oid=" + oid + ", gid=" + gid
				+ ", name=" + name + ", sum=" + sum + ", price=" + price + "]";
	}
}